<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/template/main.xhtml">

	<ui:define name="body">
		<h:form>




			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton value="#{messages['button.new']}" title="#{messages['button.new']}"
						icon="ui-icon-document" action="#{setorListMB.getNextView}"
						actionListener="#{setorListMB.clear}" ajax="false" />

					<p:commandButton value="#{messages['button.delete']}" title="#{messages['button.delete']}"
						icon="ui-icon-trash" onclick="confirmation.show()" type="button"
						immediate="true" ajax="false" />

					<p:confirmDialog message="#{messages['label.confirm.delete']}"
						showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.alert']}!" severity="alert"
						widgetVar="confirmation">

						<h:commandButton value="#{messages['button.dialog.yes']}"
							action="#{setorListMB.deleteSelection}"
							actionListener="#{setorListMB.clear}" />
						<h:commandButton value="#{messages['button.dialog.no']}"
							onclick="confirmation.hide()" type="button" />
					</p:confirmDialog>
				</p:toolbarGroup>
			</p:toolbar>

			<p:dataTable id="list" var="bean" editable="true"
				value="#{setorListMB.resultList}" paginator="true" rows="5" 
				  
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                 rowsPerPageTemplate="5,10,15,20" >


				<f:facet name="header">#{messages['setor.list.table.title']}</f:facet>
				<p:column style="width:5%;">
					<h:selectBooleanCheckbox
						value="#{setorListMB.selection[bean.id]}" />
				</p:column>

				<p:column style="width:5%;" sortBy="#{bean.id}">
					<f:facet name="header">#{messages['setor.label.id']}</f:facet>
					<h:outputText value="#{bean.id}" />
				</p:column>

				<p:column sortBy="#{bean.descricao}">
					<f:facet name="header">#{messages['setor.label.descricao']}</f:facet>
					<h:commandLink action="#{setorListMB.getNextView}"
						actionListener="#{setorListMB.clear}">
						<h:outputText value="#{bean.descricao}" />
						<f:param name="id" value="#{bean.id}" />
					</h:commandLink>
				</p:column>				
								
				
			</p:dataTable>
		</h:form>
	</ui:define>
</ui:composition>